<?php
class Merchant_Model_CustomerDepositOrder 
{
 
	private $_table;
	//Initalizing Db Table  
	public function __construct(){
		$this->_table = new Merchant_Model_DbTable_CustomerDepositOrder();
	}
	
	/**
	*add DB Adapter  
	*/	
	public function getAdapter(){
		return $this->_table->getAdapter();
	}
	/**
	*add One Row  
	*@param array $row 
	*@return boolean
	*/
	public function add($row){
		return $this->_table->insert($row);
	}
	/**
	*Update One Row  
	*@param rowSet $row Customer's data 
	*@param int $customer_id 
	*@return boolean
	*/
	public  function update($row,$customerId){
	
		$where = $this->_table->getAdapter()->quoteInto('cdo_id = ?', $customerId);
 
		return $this->_table->update($row, $where);
		
	}
	
	public  function get($CdoId){
	
		$where = $this->_table->getAdapter()->quoteInto("cdo_id = ?",$CdoId);
 
		return $this->_table->fetchRow($where)->toArray();
		
	}
		
	/**
	*Lock Order 
	*@param rowSet $row Customer's data 
	*@param int $customer_id 
	*@return boolean
	*/
	public  function lockForUpdate($orderId){
	
		$db = $this->_table->getAdapter();
		$sql = "select * from customer_deposit_order where cdo_id='$orderId' for update";
 
		return $db->fetchRow($sql);
		
	} 
}